package approve.model;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Approvedoc implements Serializable{
	private static final long serialVersionUID = 1L;
	private boolean isChecked;
	private String iDApproveDoc;
	private String title;
	private String content;
	private String content2;
	private String iDEmployee;
	private String iDGroupApprove;
	private Date timecreate;
	private Integer iDStatus;
	private Integer iDTypeDoc;
	private Date timeApprove;
	private String comment;
	private String description;
	private String purpose;
	private String employeePerforment;
	private Date tripDate = new Date();
	private String totalTime;
	private String location;
	private String thisWeek;
	private String nextWeek;
	private String fullName;
	private String deparment;
	private int isView;
	private int idLabel;

	public Approvedoc() {}
	public Approvedoc(String iDApproveDoc, String title, String content,String iDEmployee, String iDGroupApprove, 
			Date timecreate,Integer iDStatus, Integer iDTypeDoc, Date timeApprove,String comment,String description,
			String purpose, String employeePerforment,Date tripDate, String totalTime, String location,String content2, int isView) {
		super();
		this.iDApproveDoc = iDApproveDoc;
		this.title = title;
		this.content = content;
		this.iDEmployee = iDEmployee;
		this.iDGroupApprove = iDGroupApprove;
		this.timecreate = timecreate;
		this.iDStatus = iDStatus;
		this.iDTypeDoc = iDTypeDoc;
		this.timeApprove = timeApprove;
		this.comment=comment;
		this.description = description;
		this.purpose = purpose;
		this.employeePerforment = employeePerforment;
		this.tripDate = tripDate ;
		this.totalTime = totalTime;
		this.location = location;
		this.content2= content2;
		this.isView = isView;
	}
	
	public Approvedoc(String iDApproveDoc, String title, String content,String iDEmployee, String iDGroupApprove, 
			Date timecreate,Integer iDStatus, Integer iDTypeDoc, Date timeApprove,String comment,String description,
			String purpose, String employeePerforment,Date tripDate, String totalTime, String location,String content2) {
		super();
		this.iDApproveDoc = iDApproveDoc;
		this.title = title;
		this.content = content;
		this.iDEmployee = iDEmployee;
		this.iDGroupApprove = iDGroupApprove;
		this.timecreate = timecreate;
		this.iDStatus = iDStatus;
		this.iDTypeDoc = iDTypeDoc;
		this.timeApprove = timeApprove;
		this.comment=comment;
		this.description = description;
		this.purpose = purpose;
		this.employeePerforment = employeePerforment;
		this.tripDate = tripDate ;
		this.totalTime = totalTime;
		this.location = location;
		this.content2= content2;
	}
	public Approvedoc(String iDApproveDoc, String title, String content,
			String iDEmployee, String iDGroupApprove, Date timecreate,
			Integer iDStatus, Integer iDTypeDoc, Date timeApprove,
			String comment,String description,String purpose, String employeePerforment, Date tripDate,
			String totalTime, String location,String content2,int view,int label) {
		super();
		this.iDApproveDoc = iDApproveDoc;
		this.title = title;
		this.content = content;
		this.iDEmployee = iDEmployee;
		this.iDGroupApprove = iDGroupApprove;
		this.timecreate = timecreate;
		this.iDStatus = iDStatus;
		this.iDTypeDoc = iDTypeDoc;
		this.timeApprove = timeApprove;
		this.comment=comment;
		this.description = description;
		this.purpose = purpose;
		this.employeePerforment = employeePerforment;
		this.tripDate = tripDate ;
		this.totalTime = totalTime;
		this.location = location;
		this.content2= content2;
		this.isView = view;
		this.idLabel = label;
	}
	public String getiDApproveDoc() {
		return iDApproveDoc;
	}

	public void setiDApproveDoc(String iDApproveDoc) {
		this.iDApproveDoc = iDApproveDoc;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getiDEmployee() {
		return iDEmployee;
	}

	public void setiDEmployee(String iDEmployee) {
		this.iDEmployee = iDEmployee;
	}

	public Date getTimecreate() {
		return timecreate;
	}

	public void setTimecreate(Date timecreate) {
		this.timecreate = timecreate;
	}

	public Integer getiDStatus() {
		return iDStatus;
	}

	public void setiDStatus(Integer iDStatus) {
		this.iDStatus = iDStatus;
	}

	public String getiDGroupApprove() {
		return iDGroupApprove;
	}

	public void setiDGroupApprove(String iDGroupApprove) {
		this.iDGroupApprove = iDGroupApprove;
	}

	public Integer getiDTypeDoc() {
		return iDTypeDoc;
	}

	public void setiDTypeDoc(Integer iDTypeDoc) {
		this.iDTypeDoc = iDTypeDoc;
	}

	public Date getTimeApprove() {
		return timeApprove;
	}

	public void setTimeApprove(Date timeApprove) {
		this.timeApprove = timeApprove;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((iDApproveDoc == null) ? 0 : iDApproveDoc.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Approvedoc other = (Approvedoc) obj;
		if (iDApproveDoc == null) {
			if (other.iDApproveDoc != null)
				return false;
		} else if (!iDApproveDoc.equals(other.iDApproveDoc))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Approvedoc [tile=" + title + "]";
	}

	
	public String getPurpose() {
		return purpose;
	}

	public void setPurpose(String purpose) {
		this.purpose = purpose;
	}
	
	public String getEmployeePerforment() {
		return employeePerforment;
	}

	public void setEmployeePerforment(String employeePerforment) {
		this.employeePerforment = employeePerforment;
	}

	public Date getTripDate() {
		return tripDate;
	}

	public void setTripDate(Date tripDate) {
		this.tripDate = tripDate;
	}

	public String getTotalTime() {
		return totalTime;
	}

	public void setTotalTime(String totalTime) {
		this.totalTime = totalTime;
	}
	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public void setContent2(String content2) {
		this.content2 = content2;
	}

	public String getContent2() {
		return content2;
	}

	public void setThisWeek(String thisWeek) {
		this.thisWeek = thisWeek;
	}

	public String getThisWeek() {
		processDate();
		return thisWeek;
	}

	public void setNextWeek(String nextWeek) {
		this.nextWeek = nextWeek;
	}

	public String getNextWeek() {
		return nextWeek;
	}
	
	String contentConverter="";
	
	public void setContentConverter(String contentConverter1) {
		contentConverter = contentConverter1;
	}
	
	public void processDate(){
		try{
			DateFormat date = new SimpleDateFormat("dd");
			DateFormat fullDate = new SimpleDateFormat("yyyy.MM.dd");
			Calendar current = Calendar.getInstance();
			current.setTime(timecreate);
			current.set(Calendar.WEEK_OF_YEAR, current.get(Calendar.WEEK_OF_YEAR));
			current.set(Calendar.DAY_OF_WEEK, current.getFirstDayOfWeek());
			int firstDateOfWeek = Integer.parseInt(date.format(current.getTime()));
			current.set(Calendar.DATE, firstDateOfWeek + 1);
			thisWeek = " ( " + fullDate.format(current.getTime());
			current.set(Calendar.DATE, firstDateOfWeek + 7);
			thisWeek += " - " + fullDate.format(current.getTime()) + " )";
			
			current = Calendar.getInstance();
			current.setTime(timecreate);
			current.set(Calendar.WEEK_OF_YEAR, (current.get(Calendar.WEEK_OF_YEAR) + 1 ));
			current.set(Calendar.DAY_OF_WEEK, current.getFirstDayOfWeek());
			firstDateOfWeek = Integer.parseInt(date.format(current.getTime()))+7;
			current.set(Calendar.DATE, firstDateOfWeek + 1);
			nextWeek = " ( " +  fullDate.format(current.getTime());
			current.set(Calendar.DATE, firstDateOfWeek + 7);
			nextWeek += " - " + fullDate.format(current.getTime()) + " )";
		}catch (Exception e) {
			e.printStackTrace(System.out);
		}
	}

	public void setChecked(boolean isChecked) {
		this.isChecked = isChecked;
	}

	public boolean isChecked() {
		return isChecked;
	}

	public void setFullName(String fullName) {
		this.fullName = fullName;
	}

	public String getFullName() {
		return fullName;
	}

	public void setDeparment(String deparment) {
		this.deparment = deparment;
	}

	public String getDeparment() {
		return deparment;
	}
	public int getIsView() {
		return isView;
	}
	public void setIsView(int isView) {
		this.isView = isView;
	}
	public void setIdLabel(int idLabel) {
		this.idLabel = idLabel;
	}
	public int getIdLabel() {
		return idLabel;
	}
	
	
}